package cn.community.care.module.system.dal.mysql.status;

import java.util.*;

import cn.community.care.framework.common.pojo.PageResult;
import cn.community.care.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.community.care.framework.mybatis.core.mapper.BaseMapperX;
import cn.community.care.module.system.controller.admin.status.vo.StatusPageReqVO;
import cn.community.care.module.system.dal.dataobject.status.StatusDO;
import org.apache.ibatis.annotations.Mapper;

/**
 * 健康状态 Mapper
 *
 * @author 超级管理员
 */
@Mapper
public interface StatusMapper extends BaseMapperX<StatusDO> {

    default PageResult<StatusDO> selectPage(StatusPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<StatusDO>()
                .eqIfPresent(StatusDO::getUserId, reqVO.getUserId())
                .eqIfPresent(StatusDO::getHeight, reqVO.getHeight())
                .eqIfPresent(StatusDO::getWeight, reqVO.getWeight())
                .eqIfPresent(StatusDO::getBloodPressure, reqVO.getBloodPressure())
                .eqIfPresent(StatusDO::getBloodGlucose, reqVO.getBloodGlucose())
                .eqIfPresent(StatusDO::getHeartRate, reqVO.getHeartRate())
                .eqIfPresent(StatusDO::getHealthScore, reqVO.getHealthScore())
                .eqIfPresent(StatusDO::getHealthDescription, reqVO.getHealthDescription())
                .orderByDesc(StatusDO::getId));
    }

}